#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

int main()
{
  char buffer[128];
  ssize_t s = read(0,buffer,sizeof(buffer));
  if(s > 0)
  {
    buffer[s] = 0;
    printf("%s\n",buffer);
  }

  //const char* message = "hello write\n";
  //write(1,message,strlen(message));


  //umask(0);
  //int fd1 = open("log.txt",O_WRONLY | O_CREAT | O_TRUNC, 0666);//写入
  //int fd1 = open("log1.txt",O_WRONLY | O_CREAT | O_APPEND,0666);
  //int fd2 = open("log2.txt",O_WRONLY | O_CREAT | O_APPEND,0666);
  //int fd3 = open("log3.txt",O_WRONLY | O_CREAT | O_APPEND,0666);
  //int fd4 = open("log4.txt",O_WRONLY | O_CREAT | O_APPEND,0666);
  //if(fd1 < 0)
  //{
  //  perror("open");
  //  return 1;
  //}
  //
  //printf("fd1: %d\n",fd1);
  //printf("fd2: %d\n",fd2);
  //printf("fd3: %d\n",fd3);
  //printf("fd4: %d\n",fd4);


  ////.autorelabelconst char *message ="aaa";
  ////write(fd1,message,strlen(message));


  //close(fd1);
  return 0;
}

























//#include <stdio.h>
//#define ONE (1<<1)
//#define TWO (1<<2)
//#define THREE (1<<3)
//#define FOUR (1<<4)
//#define FIVE (1<<5)
//void PrintText(int flags)
//{
//  if(flags & ONE)
//  {
//    printf("one\n");
//  }
//
//  if(flags & TWO)
//  {
//    printf("two\n");
//  }
//
//  if(flags & THREE)
//  {
//    printf("three\n");
//  }
//
//  if(flags & FOUR)
//  {
//    printf("four\n");
//  }
//  if(flags & FIVE)
//  {
//    printf("five\n");
//  }
//
//}
//
//
//int main()
//{
//  printf("==========================\n");
//  PrintText(ONE); 
//  printf("==========================\n");
//  PrintText(TWO);
//  printf("==========================\n");
//  PrintText(THREE);
//  printf("==========================\n");
//  PrintText(ONE | TWO);
//  printf("==========================\n");
//  PrintText(ONE | TWO | THREE);
//  printf("==========================\n");
//  PrintText(ONE | FIVE | FOUR);
//  printf("==========================\n");
//  return 0;
//}
